#include<bits/stdc++.h>

using namespace std;
int n,p,h,pp;
int a[200010],b[200010],ab[200010],c[200010];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i)
	{
		++h;
		if(a[i]!=a[i+1]||i==n)
		{
			b[++p]=h;
			ab[p]=i-h+1;
			c[p]=a[i];
			h=0;
		}
	}
	while(p)
	{
		for(int j=1;j<=p;++j)
		{
			if(c[j]!=c[j-1]||j==1)
			{
				printf("%d ",ab[j]);
				++ab[j];
				--b[j];
			}
		}
		printf("\n");
		n=p;
		p=0;
		for(int j=1;j<=n;++j)
		{
			if(b[j])
			{
				b[++p]=b[j],ab[p]=ab[j],c[p]=c[j];
			}
		}
	}
	return 0;
}
